<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<script type="text/javascript">
    function page(n, s) {
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#searchForm").submit();
        return false;
    }

    function printPrescNurses() {
        var day=$("#day").val();
        if(day == null || day == ""){
            toastr.info( "请填写要打印天数，再打印");
        }else {
            printPdf('${ctx}/doctor/prescriptionApply/printPrescNurses', 'day=' + day);
        }
    }
</script>
<div class="content-wrap">
    <div class="wrapper" style="bottom: 50px;">
        <ul class="nav nav-tabs">
            <li><a href="#" onclick="loadDiv('mainCenterDiv','${ctx}/nurse/index')">床位列表</a></li>
            <li class="active">
                <a href="#" onclick="loadDiv('mainCenterDiv','${ctx}/doctor/prescriptionApply/prescriptionVisit')">处方汇总表</a>
            </li>
        </ul>
        <section class="panel panel-default">
            <div class="panel-body">
                <div class="table-responsive no-border">
                    <div class="datatable-top">
                        <div class="pull-left">
                            <form:form id="searchForm" modelAttribute="prescriptionApply"
                                       onsubmit="return loadDivForm('mainCenterDiv','searchForm','${ctx}/doctor/prescriptionApply/prescriptionVisit');"
                                       method="post" class="form-inline">
                                <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                                <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                                <input name="inFlag" type="hidden" value="1">
                                <label>查看</label><form:input path="day" id="day" type="number" htmlEscape="false" maxlength="50"
                                                             class="form-control"/><label>天内的处方</label> &nbsp;&nbsp;&nbsp;
                                &nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
                                &nbsp;<input id="btnReg" class="btn btn-primary" type="button" onclick="printPrescNurses()" value="打印"/>
                            </form:form>
                        </div>
                    </div>
                    <table id="contentTable" class="table table-bordered mg-t datatable">
                        <thead>
                        <tr>
                            <th>床号</th>
                            <th>姓名</th>
                            <th>药品名称</th>
                            <th>单次剂量</th>
                            <th>剂量单位</th>
                            <th>总量</th>
                            <th>单位</th>
                            <th>规格</th>
                            <th>计价</th>
                            <th>患者签字</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:set var="bedno" value="" />
                        <c:forEach items="${page.list}" var="prescriptionVisit">
                            <tr>
                                <c:if test="${prescriptionVisit.bedno == bedno}">
                                    <td>&nbsp;</td>
                                    <td>&nbsp;</td>
                                </c:if>
                                <c:if test="${prescriptionVisit.bedno != bedno}">
                                    <td>${prescriptionVisit.bedno}</td>
                                    <td>${prescriptionVisit.name}</td>
                                    <c:set var="bedno" value="${prescriptionVisit.bedno}" />
                                </c:if>
                                <td>${prescriptionVisit.drugname}</td>
                                <td>${prescriptionVisit.dosageeach}</td>
                                <td>${prescriptionVisit.dosageunits}</td>
                                <td>${prescriptionVisit.dosage}</td>
                                <td>${prescriptionVisit.packageunits}</td>
                                <td>${prescriptionVisit.packageSpec}</td>
                                <td>${prescriptionVisit.costs}</td>
                                <td>${prescriptionVisit.patient}</td>

                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                    <div class="pagination">${page}</div>
                </div>
            </div>
        </section>
    </div>
</div>